<?php
/*后台操作日志控制器
 * @Descripttion: 
 * @Author: 荷逸
 * @email: 563428234@qq.com
 * @Date: 2021-03-08 16:41:35
 */
namespace app\admin\controller;

use app\admin\model\AdminLog;
use app\admin\model\AdminUser;
use think\Request;

class AdminLogController extends Controller
{

    public function index(Request $request, AdminLog $model)
    {
        $param = $request->param();
        $month = (isset($param['month']) && !empty($param['month']))
        ? date('Ym',strtotime($param['month']))
        : date('Ym');
        $data  = $model->setMonth($month)->scope('where', $param)->paginate(['list_rows'=>$this->admin['per_page'],'query' => $request->get()]);
        //关键词，排序等赋值
        $this->assign($request->get());

        $this->assign([
            'data'            => $data,
            'page'            => $data->render(),
            'total'           => $data->total(),
            'admin_user_list' => AdminUser::select(),
        ]);

        return $this->fetch();
    }

    //日志详情
    public function view($id, AdminLog $model)
    {
        $data = $model::find($id);
        $this->assign([
            'data' => $data
        ]);
        return $this->fetch();
    }

}
